import { defineStore } from 'pinia';

export const useSaveList = defineStore('saveList', {
	state: () => ({
		playersListId:[],
		nextId:''
	}),
	actions: {
		// 保存列表
		saveList(data) {
			this.playersListId = data
		},
		// 寻找当前播放歌曲的下一首歌
		nextID(id) {
			for(let i = 0; i < this.playersListId.length; i++){
				if(this.playersListId[i].id == id){
					this.nextId = this.playersListId[i + 1].id
				}
			}
			
		}
	},
});